package com.wangsh.splider.system.pojo;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

import com.wangsh.splider.common.pojo.BasePojo;

public class ASysProxy extends BasePojo<ASysProxy>{
	private int id;
	private int countryId;
	private int ipId;
	private String ip;
	private String port;
	private int totalNum;
	private int succedNum;
	private int failedNum;
	private int randInt;
	private String content;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;
	private int proxyType;
	private ASysIp sysIp;
	private ASysCountry sysCountry;
	/*--字符串表示--*/
	private String statusStr ; 
	private String typeStr;
	/* 存储所有状态的容器 */
	private Map<String,String> enumsMap = new TreeMap<String, String>();

	public Map<String, String> getEnumsMap()
	{
		// 根据状态值获取字符串描述
		ASysProxyEnum[] enums = ASysProxyEnum.values();
		for (int i = 0; i < enums.length; i++)
		{
			ASysProxyEnum enumTemp = enums[i];
			String key = enumTemp.toString() ; 
			if(key.lastIndexOf("_") != -1)
			{
				key = key.substring(0,key.lastIndexOf("_")) ; 
			}
			enumsMap.put(key + "-" + enumTemp.getStatus() + "", enumTemp.getName());
		}
		return enumsMap;
	}
	
	public String getTypeStr()
	{
		// 根据状态值获取字符串描述
		ASysProxyEnum[] enums = ASysProxyEnum.values();
		for (int i = 0; i < enums.length; i++)
		{
			ASysProxyEnum enumTemp = enums[i];
			if (enumTemp.toString().startsWith("TYPE_"))
			{
				// 判断获取到的代理类型和当前pojo的代理类型是否相同 相同就输出名字
				if (enumTemp.getStatus() == this.getProxyType())
				{
					this.statusStr = enumTemp.getName();
					break;
				}
			}
		}
		return statusStr;
	}
	
	public String getStatusStr()
	{
		// 根据状态值获取字符串描述
		ASysProxyEnum[] enums = ASysProxyEnum.values();
		for (int i = 0; i < enums.length; i++)
		{
			ASysProxyEnum enumTemp = enums[i];
			if (enumTemp.toString().startsWith("STATUS_"))
			{
				// 表示是状态的标识
				if (enumTemp.getStatus() == this.getStatus())
				{
					this.typeStr = enumTemp.getName();
					break;
				}
			}
		}
		return typeStr;
	}
	
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getCountryId() {
		return countryId;
	}
	public void setCountryId(int countryId) {
		this.countryId = countryId;
	}
	public int getIpId() {
		return ipId;
	}
	public void setIpId(int ipId) {
		this.ipId = ipId;
	}
	
	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getPort() {
		return port;
	}
	public void setPort(String port) {
		this.port = port;
	}
	public int getTotalNum() {
		return totalNum;
	}
	public void setTotalNum(int totalNum) {
		this.totalNum = totalNum;
	}
	public int getSuccedNum() {
		return succedNum;
	}
	public void setSuccedNum(int succedNum) {
		this.succedNum = succedNum;
	}
	public int getFailedNum() {
		return failedNum;
	}
	public void setFailedNum(int failedNum) {
		this.failedNum = failedNum;
	}
	public int getRandInt() {
		return randInt;
	}
	public void setRandInt(int randInt) {
		this.randInt = randInt;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public byte getStatus() {
		return status;
	}
	public void setStatus(byte status) {
		this.status = status;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public Date getPubTime() {
		return pubTime;
	}
	public void setPubTime(Date pubTime) {
		this.pubTime = pubTime;
	}

	public ASysIp getSysIp() {
		return sysIp;
	}

	public void setSysIp(ASysIp sysIp) {
		this.sysIp = sysIp;
	}

	public ASysCountry getSysCountry() {
		return sysCountry;
	}

	public void setSysCountry(ASysCountry sysCountry) {
		this.sysCountry = sysCountry;
	}

	public int getProxyType() {
		return proxyType;
	}

	public void setProxyType(int proxyType) {
		this.proxyType = proxyType;
	}

	@Override
	public String toString() {
		return "ASysProxy [ip=" + ip + ", port=" + port + ", proxyType=" + proxyType + "]";
	}

	
	

	
	
	
	
	
	
}
